﻿// EXP0218.cpp : 编写代码分别改变指针的值以及指针所指对象的值。

//int a = 0, b = 1;
//int* p1 = &a, * p2 = p1;
//
//// change the value of a pointer.
//p1 = &b;
//// change the value to which the pointer points
//*p2 = b;
////

#include <iostream>
using namespace std;

int main()
{
    int a = 0, b= 1;
    int* p1 = &a, * p2 = p1;
    //改变指针的值
    p1 = nullptr;
    //改变指针所指对象的值
    *p2 = b;

    return 0;
}

